﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

namespace LabMS.Web.LabEvaluation
{
    public partial class PreViewEvaluationTitle : Base.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            strPagePrivilege.Add("ZDPGZT");
            strPageUserType.Add("mana");
            if (Request.QueryString["ID"] != null)
            {
                if (!IsPostBack)
                {
                    int ID;
                    if (int.TryParse(Request.QueryString["ID"].ToString(), out ID))
                    {
                        IDHF.Value = ID.ToString();
                        LabMS.BLL.EvaluationTitle EvaTitle = new LabMS.BLL.EvaluationTitle();
                        LabMS.Model.EvaluationTitle EvaTitleModel = new LabMS.Model.EvaluationTitle();

                        EvaTitleModel = EvaTitle.GetModel(ID);
                        TitleCodeLbl.Text = EvaTitleModel.Title_Code.ToString();//编号
                        TitleNameLbl.Text = EvaTitleModel.Title_Name;//名称
                        AuthorLbl.Text = EvaTitleModel.Title_Author;//作者
                    }
                    else
                    {
                        ERRLbl.Text = "系统异常，参数不合法！";
                        ERRLbl.Visible = true;
                        mondifybtn.Visible = false;
                    }
                }
            }
            else
            {
                ERRLbl.Text = "系统异常，参数为空！";
                ERRLbl.Visible = true;
                mondifybtn.Visible = false;
            }
        }


        protected void Delete_OnClick(object sender, EventArgs e)
        {
            ExtendBLL.LabEvaluation labEva = new ExtendBLL.LabEvaluation();

            string ID = IDHF.Value;
            List<string> strID = new List<string>();
            List<string> strTable = new List<string>();
            List<string> strColName = new List<string>();
            #region 评估主题
            strID.Add(ID);
            strTable.Add("EvaluationTitle");
            strColName.Add("ID");
            #endregion
            #region 评估标准
            strID.Add(ID);
            strTable.Add("Standard");
            strColName.Add("EvTitleID");
            #endregion
            try
            {
                labEva.DeleteEval(strID, strTable, strColName);
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('删除成功!');refreshParent();wincolse();</script>");
            }
            catch
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('删除失败!');refreshParent();wincolse();</script>");
                return;
            }

        }


    }
}
